<style type="text/css">
	.g_list .mytd{height:25px;}
	.title_pic{float: left;}
	.title{float:right;width:70%;}
	.text-center{font-size: 14px;}
.orderCount {
	border: 1px solid #8edbef;
	bottom: 1px;
	font-size: 12px;
	padding: 0 1px;
	text-align: center;
	width: 20px;
}
.biaoqian{cursor: pointer;border: 1px solid #8edbef;padding: 3px;border-radius: 2px;background: #8edbef;color: #fff;}
.zhankais{cursor: pointer;float: right;color:#f88e2d;font-size: 13px;}
</style>
<script type="text/javascript"> 
jQuery.fn.rowspan = function(colIdx) { //封装的一个JQuery小插件  
return this.each(function(){ 
var that; 
$('tr', this).each(function(row) { 
$('td:eq('+colIdx+')', this).filter(':visible').each(function(col) { 
if (that!=null && $(this).html() == $(that).html()) { 
rowspan = $(that).attr("rowSpan"); 
if (rowspan == undefined) { 
$(that).attr("rowSpan",1); 
rowspan = $(that).attr("rowSpan"); } 
rowspan = Number(rowspan)+1; 
$(that).attr("rowSpan",rowspan); 
$(this).hide(); 
} else { 
that = this; 
}  
}); 
}); 
}); 
}

$(function() {
	$(".g_list").rowspan(5);
	$(".g_list").rowspan(6);
	$(".g_list").rowspan(7);
	$(".g_list").rowspan(8);
	$(".g_list").rowspan(9);
$(".zhankais").click(function(){
	var pd=$(this).text();
	var myrel=$(this).attr('rel');
	if(pd=='收回明细'){
		$(this).text('展开明细');
		$(this).removeClass('glyphicon-chevron-up');
		$(this).addClass('glyphicon-chevron-down');
		
	}else{
		$(this).removeClass('glyphicon-chevron-down');
		$(this).addClass('glyphicon-chevron-up');
		$(this).text('收回明细');
	}
	$(".zhankai"+myrel).slideToggle();
	}); 
}); 

</script>
             <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                <div class="table-responsive">
                    <table class="table table-bordered" style="font-size:13px;">
                                <tbody>
                                <volist name="orderList" id="list">
                                    <tr style="border-bottom: 2px #fff solid;">
                                        <td class="text-center" style="background:#EAF8FF;">
                                        	<if condition='$list[shipping_status] neq 1'><input type="checkbox" name="order_id[]" title="已发货的订单不能批量编辑" value="{$list.order_id}"></if>
                                        	<input type="hidden" name="shipping_code[]" value="flat.flat">
											<span class="glyphicon glyphicon-chevron-up zhankais" rel="{$list.order_id}">收回明细</span>
                                        </td>
                                        <td class="text-center" style="background:#EAF8FF;">单号：{$list.order_sn}</td>
                                        <td class="text-center" style="background:#EAF8FF;">状态：{$order_status[$list[order_status]]}<if condition="$list['is_cod'] eq '1'"><span style="color: red">(货到付款)</span></if></td>
                                        <td class="text-center" style="background:#EAF8FF;">发货：{$shipping_status[$list[shipping_status]]}</td>
                                        <td class="text-center" style="background:#EAF8FF;">下单时间：{$list.add_time|date='Y-m-d H:i',###}</td>
                                        <td class="text-right" style="background:#EAF8FF;">
                                                 <a href="{:U('Seller/order/detail',array('order_id'=>$list['order_id']))}" data-toggle="tooltip" title="" class="btn btn-info" data-original-title="查看详情"><i class="fa fa-eye"> 查看</i></a>
                                                 <a href="/index.php/Seller/Order/order_print/order_id/{$list.order_id}" target="_blank" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="打印订单"><i class="fa fa-print"></i>打印订单
                                                 </a>
                                                 <if condition="($list['order_status'] eq 3) or ($list['order_status'] eq 5)">
                                                        <a href="{:U('Seller/order/delete_order',array('order_id'=>$list['order_id']))}"  data-toggle="tooltip" title="" class="btn btn-danger" data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                        	<else/>
                                        		<a href="javascript:void(0)" onclick="alert('该订单不得删除')" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="删除"><i class="fa fa-trash-o"></i></a>
                                        	</if>
                                                
                                        </td>
                                    </tr>

<tr class="zhankai{$list.order_id}">
	<td class="text-center" colspan="10" style="padding:0;">
<table class="table table-bordered g_list" style="font-size:13px;width:100%;">
<tr>
		<td width="200" class="mytd">产品名</td>
		<td width="110" class="mytd">单价</td> 
		<td width="90" class="mytd">数量</td>
		<td width="90" class="mytd">小计</td>
		<td width="80" class="mytd">平台扣点</td>
		<td width="80" class="mytd">平台收益</td>
		<td width="120" class="mytd">收件人</td>
		<td width="120" class="mytd">联系电话</td>
		<td width="130" class="mytd">总金额</td>
</tr>
<?php
$points_count=0;
?>
<volist name="list.g_list" id="lists">
	<?php
	$points_count+=$lists['points']*$lists['member_goods_price']*$lists['goods_num']/100;
	?>
	<tr>
		<td style="text-align:left;">
			<img src="{$lists.original_img}" height="50" width="50" class="title_pic" onmouseover="layer.tips('<img src={$lists.original_img} width=180>',this,{tips: [1, '#EAF8FF']});" onmouseout="layer.closeAll();">
			<div class="title">{$lists.goods_name}</div>
			<div class="title" style="color:#8e8a8a;">{$lists.spec_key_name}</div>
			</td>
		<td class="mytd">￥{$lists.member_goods_price}</td> 
		<td class="mytd">{$lists.goods_num}</td>
		<td class="mytd">{:sanwei(($lists['member_goods_price']*$lists['goods_num']))}</td>
		<td class="mytd">{$lists.points}%</td>
		<td class="mytd" style="color: blue;">{:sanwei(($lists['points']*$lists['member_goods_price']*$lists['goods_num'])/100)}</td>
		<td class="mytd">{$list.consignee}（{$list.company}）</td>
		<td class="mytd">{$list.mobile}</td>
		<td class="mytd" style="font-weight: bold;color: red;">{$list.total_amount}</td>
	</tr>
</volist>
<tr>
	<td class="text-right" colspan="5">平台总扣费：</td>
	<td class="text-center" style="color: blue;font-weight: bold;">{:sanwei($points_count)}</td>
	<td class="text-right" colspan="2" style="font-weight: bold;">应收：</td>
	<td class="text-center" style="color: red;font-weight: bold;">{:($list['order_amount']-sanwei($points_count))}</td>
	</tr>
	<td class="text-center" colspan="6" style="">
		<b>平台改单：</b>
					<if condition="$list.admin_note eq ''">
							<span style="color:#999;">未改单</span>
					<else/>
							<span style="color:red;">改价：<b>￥{$list.discount}</b>，{$list.admin_note|htmlspecialchars_decode}</span>
					</if>
	</td>
	<td class="text-center" colspan="1" style="color:green;">入库：（{$list.ruku}件）</td>
    <td class="text-center" colspan="1" style="color:red;">发货：（{$list.chuku}件）</td>
	<td class="text-left" colspan="1" style="font-size: 12px;">
		标签数：<input class="orderCount" type="text" value="{$list.jian_count}" onkeyup="this.value=this.value.replace(/[^\d]/g,'0')" onchange="update_biaoqian('order','order_id','{$list.order_id}','jian_count',this)" onpaste="this.value=this.value.replace(/[^\d]/g,'')" {$list.biaoqian} />
				<i class="fa fa-print biaoqian" rel="{$list.order_id}">打印</i>
	</td>
</tr>
</table>
	</td>
</tr>

                                </volist>
                                </tbody>
                            </table>
                        </div>
                    </form>
                    <div class="row">
    <div class="navbar-form form-inline">
        全选
        <input type="checkbox" onclick="$('input[name=\'order_id\[\]\']').prop('checked', this.checked);">
        <div class="form-group">
            <select id="func_id" class="form-control" style="width: 120px;">
                <option value="-1">请选择...</option>
<!-- 				<option value="fahuo">一键发货</option> -->
<!--                <option value="confirm">确认订单</option>
				<option value="cancel">取消确认</option> -->
                <option value="invalid">作废订单</option>
            </select>
        </div>
        <button id="act_button" type="button" onclick="act_submit();" class="btn btn-primary"><i class="fa"></i> 确定</button>
    </div>
                        <div class="col-sm-6 text-right">{$page}</div>
                    </div>
<script>
    $(".pagination a").click(function(){
        var page = $(this).data('p');
        ajax_get_table('search-form2',page);
    });
    $(".biaoqian").click(function(){
		var obj=$(this).parent();
		var order_id=obj.find('i').attr('rel');
		var num=parseInt(obj.find('.orderCount').val());
		if(num<=0){
			layer.msg('标签数不能为0哦！', {icon: 5});return;
		}
		window.open('/index.php/Seller/Order/biaoqian_print/order_id/'+order_id);
    });

	
    //获取选中商品id
    function get_select_order_id_str() {
        if ($('input[name="order_id\[\]"]:checked').length == 0)
            return false;
        var goods_arr = Array();
        $('input[name="order_id\[\]"]:checked').each(function () {
            goods_arr.push($(this).val());
        });
        var order_id_str = goods_arr.join(',');
        return order_id_str
    }

    //批量操作提交
    function act_submit() {
        //prompt层
		var type=$("#func_id").val();
        var ids = get_select_order_id_str();
        if (ids == false) {
            layer.alert('请勾选要操作的订单', {icon: 2});
            return;
        }
		if(type=='-1'){
			layer.alert('请选择操作类型', {icon: 2});
			return;
		}
        var text = prompt('请输入操作备注', '填写操作备注,可不填');
        if (text != null && text != "") {
            $.ajax({
                type: "POST",
                url: "/index.php/Seller/order/order_actions",//+tab,window.location.reload();
                data: {type: type,order_ids: ids, reason: text},
                success: function (data) {
					if(data=='0'){
						layer.alert('订单修改成功！', {icon: 6},function(e){
							window.location.reload();
						});
					}else{
						layer.alert('系统错误！', {icon: 5});
					}
                },
                error:function(){
                    layer.alert('网络异常', {icon: 2,time: 3000});
                }
            });
        }
    }
</script>